package com.ericsson.epc.modules.autocheck.service.impl;

import com.ericsson.enap.modules.autoCheck.entity.NetAutoCheck;
import com.ericsson.enap.modules.autoCheck.mapper.VisAutoCheckLogMapper;
import com.ericsson.enap.modules.autoCheck.mapper.VisAutoCheckMqIdGeneratorMapper;
import com.ericsson.enap.modules.autoCheck.mapper.VisExcelMapper;
import com.ericsson.enap.modules.autoCheck.mapper.VisExcelModuleDetailMapper;
import com.ericsson.epc.modules.autocheck.entity.EpcAutomqDict;
import com.ericsson.epc.modules.autocheck.entity.EpcNetAutoCheck;
import com.ericsson.epc.modules.autocheck.entity.EpcVisAutoCheckLog;
import com.ericsson.epc.modules.autocheck.entity.EpcVisAutoCheckMq;
import com.ericsson.epc.modules.autocheck.entity.EpcVisAutoCheckMqIdGenerator;
import com.ericsson.epc.modules.autocheck.entity.EpcVisExcel;
import com.ericsson.epc.modules.autocheck.entity.EpcVisExcelModuleDetail;
import com.ericsson.epc.modules.autocheck.mapper.EpcAutomqDictMapper;
import com.ericsson.epc.modules.autocheck.mapper.EpcNetAutoCheckMapper;
import com.ericsson.epc.modules.autocheck.mapper.EpcVisAutoCheckLogMapper;
import com.ericsson.epc.modules.autocheck.mapper.EpcVisAutoCheckMqIdGeneratorMapper;
import com.ericsson.epc.modules.autocheck.mapper.EpcVisAutoCheckMqMapper;
import com.ericsson.epc.modules.autocheck.mapper.EpcVisExcelMapper;
import com.ericsson.epc.modules.autocheck.mapper.EpcVisExcelModuleDetailMapper;
import com.ericsson.epc.modules.autocheck.service.EpcEopsTemplateScheduleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
public class EpcEopsTemplateScheduleServiceImpl implements EpcEopsTemplateScheduleService {
    @Resource
    private EpcVisExcelMapper epcVisExcelMapper;

    @Resource
    private EpcVisExcelModuleDetailMapper epcModuleDetailMapper;
    @Resource
    private EpcNetAutoCheckMapper epcNetAutoCheckMapper;

    @Resource
    private EpcVisAutoCheckLogMapper epcVisAutoCheckLogMapper;
    @Resource
    private EpcAutomqDictMapper epcAutomqDictMapper;
    @Resource
    private EpcVisAutoCheckMqMapper epcAutoCheckMqMapper;

    @Resource
    public EpcVisAutoCheckMqIdGeneratorMapper epcVisAutoCheckMqIdGeneratorMapper;

    @Override
    public List<EpcVisExcel> getBizTemplates(String types) {
        return epcVisExcelMapper.getBizTemplates(types);
    }

    @Override
    public List<EpcVisExcelModuleDetail> getModuleDetailsByExcelIds(String ids) {
        return epcModuleDetailMapper.getModuleDetailsByExcelIds(ids);
    }

    @Override
    public List<EpcNetAutoCheck> getWorkingElementsByIP(String ip) {

        List<EpcNetAutoCheck> workingElements = new ArrayList<>();
        workingElements.addAll(epcNetAutoCheckMapper.getEopsWorkingNets(ip));
        workingElements.addAll(epcNetAutoCheckMapper.getEopsWorkingOthers(ip));
        return workingElements;
    }

    @Override
    public void insertAutoCheckLog(EpcVisAutoCheckLog visAutoCheckLog) {
        epcVisAutoCheckLogMapper.insert(visAutoCheckLog);
    }

    @Override
    public List<EpcAutomqDict> getEpcAutomqDictList() {
        return epcAutomqDictMapper.getAutomqDictList();
    }

    @Override
    public List<EpcVisAutoCheckMq> getAutoCheckMqList() {
        return epcAutoCheckMqMapper.getAutoCheckMqList();
    }

    @Override
    public List<EpcVisAutoCheckLog> getCurrentTimeAlarm() {
        return epcVisAutoCheckLogMapper.getCurrentTimeAlarm();
    }

    @Override
    public EpcVisAutoCheckMqIdGenerator getIdByType(String type) {
        return epcVisAutoCheckMqIdGeneratorMapper.getIdByType(type);
    }

    @Override
    public void insertAutoCheckMq(EpcVisAutoCheckMq visAutoCheckMq) {
        epcAutoCheckMqMapper.insertAutoCheckMq(visAutoCheckMq);
    }

    @Override
    public void updateIdValue(EpcVisAutoCheckMqIdGenerator visAutoCheckMqIdGenerator) {
        epcVisAutoCheckMqIdGeneratorMapper.updateIdValue(visAutoCheckMqIdGenerator);
    }

    @Override
    public void updateAutoCheckMq(EpcVisAutoCheckMq visAutoCheckMq) {
        epcAutoCheckMqMapper.updateAutoCheckMq(visAutoCheckMq);
    }
}
